#include <bits/stdc++.h>
using namespace std;
using uint=unsigned int;
using ll=long long;
using ull=unsigned long long;
using i128=__int128;
const int N=1e6+5;

void solve(){
    int n, m;
    cin >> n >> m;
    int tx = -1, ty = -1;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        for (int j = 0; j < m; ++j) {
            if (s[j] == '#') {
                tx = i + 1;
                ty = j + 1;
            }
        }
    }
    bool safe1 = !((tx == 1 && ty <= m) || (ty == m && tx <= n));
    if (safe1) {
        for (int i = 0; i < m - 1; ++i) cout << 'D';
        for (int i = 0; i < n - 1; ++i) cout << 'S';
    } else {
        for (int i = 0; i < n - 1; ++i) cout << 'S';
        for (int i = 0; i < m - 1; ++i) cout << 'D';
    }
    cout << endl;
    return;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    solve();

    return 0;
}